package register

import "github.com/gin-gonic/gin"

type Register func(*gin.Engine)

var globalRegisters = []Register{}

// 路由器
func Include(registers ...Register) {
	globalRegisters = append(globalRegisters, registers...)
}

// 遍历并初始化路由器
func Init() *gin.Engine {
	engine := gin.Default()
	for _, register := range globalRegisters {
		register(engine)
	}
	return engine
}
